package dk.twu.analyzer.console.model;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * Created by TW on 12/21/2014.
 */
public class DateElement implements ICommandElement {
    private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
    private final LocalDate date;

    public DateElement(LocalDate date) {
        this.date = date;
    }

    @Override
    public String getShortDescription() {
        if (date == null) {
            return "N/A";
        } else {
            return date.format(DATE_FORMATTER);
        }
    }
}
